from toee import *
from utilities import *

def san_dialog( attachee, triggerer ):
	if (attachee.area != 3):
		if (attachee.leader_get() != OBJ_HANDLE_NULL):
			triggerer.begin_dialog( attachee, 90 )
		elif (attachee.has_met(triggerer)):
			triggerer.begin_dialog( attachee, 80 )
		else:
			triggerer.begin_dialog( attachee, 1 )
	return SKIP_DEFAULT

def san_enter_combat( attachee, triggerer ):
	attachee.float_line(12057,triggerer)
	return RUN_DEFAULT

def san_dying( attachee, triggerer ):
	attachee.float_line(12014,triggerer)
	if (attachee.leader_get() != OBJ_HANDLE_NULL):
		game.global_vars[29] = game.global_vars[29] + 1
	return RUN_DEFAULT

def san_new_map( attachee, triggerer ):
	if (attachee.area == 3):
		obj = attachee.leader_get()
		if (obj != OBJ_HANDLE_NULL):
			obj.begin_dialog(attachee, 110)
	return RUN_DEFAULT

def run_off( attachee, triggerer ):
	attachee.runoff(attachee.location-3)
	return RUN_DEFAULT

def get_rep( attachee, triggerer ):
	if triggerer.reputation_has( 16 ) == 0:
		triggerer.reputation_add( 16 )
	game.global_vars[26] = game.global_vars[26] + 1
	if ( game.global_vars[26] >= 3 and triggerer.reputation_has( 17 ) == 0):
		triggerer.reputation_add( 17 )
	return RUN_DEFAULT